#include "includes.h"

#define TASK1_PRO     1
#define TASK2_PRO     2
#define TASK3_PRO     3

OS_STK        Task1Stk[TASK_STK_SIZE];
OS_STK        Task2Stk[TASK_STK_SIZE];
OS_STK        Task3Stk[TASK_STK_SIZE];

static void Task1(void *p_arg);
static void Task2(void *p_arg);
static void Task3(void *p_arg);

void TaskCreate(void)
{
	OSTaskCreate(Task1,NULL,&Task1Stk,TASK1_PRO);
	OSTaskCreate(Task2, NULL, &Task2Stk, TASK2_PRO);
	OSTaskCreateExt(Task3, NULL, &Task3Stk, TASK3_PRO, TASK3_PRO, &Task3Stk[TASK_STK_SIZE - 1], TASK_STK_SIZE, NULL, 0);
}


static void Task1(void *p_arg)
{
	p_arg = p_arg;

	while (1)
	{
		printf("Task1 is running!\n");
		OSTimeDlyHMSM(0,0,2,0);

	}
}

static void Task2(void *p_arg)
{
	p_arg = p_arg;

	while (1)
	{
		printf("Task2 is running!\n");
		OSTimeDlyHMSM(0, 0, 1, 0);
	}
}

static void Task3(void *p_arg)
{
	p_arg = p_arg;

	while (1)
	{
		printf("Task3 is running!\n");
		OSTimeDlyHMSM(0, 0, 0, 500);
	}
}